package com.zjxd.business.web.api.resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zjxd.business.web.code.ApiResultCode;
import com.zjxd.business.web.common.ApiResult;

/**
 * 资源模块管理
 * @author dj
 *
 */
@RestController
@RequestMapping("api/resource")
public class ResourceController {

	@Autowired 
	private ResourceService resourceService;
	
	/**
	 * 根据用户id获得顶层的模块去权限列表(初始化左侧菜单)
	 * @param userid
	 * @return
	 */
	@RequestMapping(value="/getListByUserid",method = RequestMethod.GET)
	public ApiResult getListByUserid(Long userid) {
		
		if (userid == null ) {
			return ApiResult.fail(ApiResultCode.parameter_error_code);
		}
		return  ApiResult.success(resourceService.getListByUserid(userid));
	}
}
